package com.xucan.utils;

import java.util.regex.Pattern;
import java.util.regex.Matcher;
 
public class RegexExample {
    public static void main(String[] args) {
        String regex = "^[+]?[0-9]*\\.?[0-9]+$"; // 例如，校验整数
        Pattern pattern = Pattern.compile(regex);
        Matcher matcher = pattern.matcher("a"); // 替换为你要校验的字符串
        if (matcher.matches()) {
            System.out.println("匹配成功！");
        } else {
            System.out.println("匹配失败！");
        }
    }
}